<!DOCTYPE html>
<html lang="en-us">
<head><head>
    <meta name="google-site-verification" content="9vIieCe-Qpd78QOmBl63rGtIVbhY6sYyuxX3j8XWBA4" />
    <meta name="baidu-site-verification" content="LRrmH41lz7" />
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <meta name="description" content="mongodb副本集群部署，备份，恢复与常用命令">
    
    <meta name="keyword"  content=", , 马少勋的网络日志, 马少勋的博客, Mashaoxun Blog, 博客, 个人网站, 互联网, Web, 云原生, PaaS, Istio, Kubernetes, 微服务, Microservice">
    <link rel="shortcut icon" href="/blog/img/favicon.ico">

    <title>mongodb副本集群部署，备份，恢复与常用命令-马少勋的博客 | MaShaoXun Blog</title>

    <link rel="canonical" href="/blog/2020/09-02/mongodb-install/">

    <link rel="stylesheet" href="/blog/css/iDisqus.min.css"/>
	
    
    <link rel="stylesheet" href="/blog/css/bootstrap.min.css">

    
    <link rel="stylesheet" href="/blog/css/hux-blog.min.css">

    
    <link rel="stylesheet" href="/blog/css/syntax.css">

    
    <link rel="stylesheet" href="/blog/css/zanshang.css">

    
    <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    
    
    <script src="/blog/js/jquery.min.js"></script>
    
    
    <script src="/blog/js/bootstrap.min.js"></script>
    
    
    <script src="/blog/js/hux-blog.min.js"></script>
	
    
    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/dockerfile.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/vim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/yaml.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/go.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/bash.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/shell.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/nginx.min.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
</head>
</head>

<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">Mashaoxun Blog</a>
        </div>

        
        
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/blog">Home</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/django">django</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/docker">docker</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/k8s">k8s</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/redis">redis</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/swarm">swarm</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/%E5%AD%98%E5%82%A8">存储</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/%E7%9B%91%E6%8E%A7">监控</a>
                    </li>
                    
                    
		    
                        <li><a href="/blog/top/about/">ABOUT</a></li>
                    

                    
		    <li>
                        <a href="/blog/search">SEARCH <img src="/blog/img/search.png" height="15" style="cursor: pointer;"></a>
		    </li>
                    
                </ul>
            </div>
        </div>
        
    </div>
    
</nav>
<script>
    
    
    
    var $body   = document.body;
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        
            $navbar.className = " ";
            
            setTimeout(function(){
                
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>




<style type="text/css">
    header.intro-header {
        background-image: url('/blog/img/youyou.jpg')
    }
</style>
<header class="intro-header">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <div class="tags">
                        
                        <a class="tag" href="/blog/tags/%E5%AD%98%E5%82%A8" title="存储">
                            存储
                        </a>
                        
                    </div>
                    <h1>mongodb副本集群部署，备份，恢复与常用命令</h1>
                    <h2 class="subheading"></h2>
                    <span class="meta">
			Posted by 
			
			         &#34;马少勋&#34;
			 
			on 
			Wednesday, September 2, 2020
                        
                    </span>
                </div>
            </div>
        </div>
    </div>
</header>




<article>
    <div class="container">
        <div class="row">

            
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

                
                <header>
                    <h2>TOC</h2>
                </header>
                <nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#mongodb副本集群部署-备份-恢复与常用命令">mongodb副本集群部署，备份，恢复与常用命令</a>
<ul>
<li><a href="#一-部署">一、部署</a>
<ul>
<li><a href="#1-实验环境">1、实验环境</a></li>
<li><a href="#2-下载">2、下载</a></li>
<li><a href="#3-解压安装包">3、解压安装包</a></li>
<li><a href="#4-修改配置文件">4、修改配置文件</a></li>
<li><a href="#5-集群认证keyfile">5、集群认证keyFile</a></li>
<li><a href="#6-配置systemd启动">6、配置systemd启动</a></li>
<li><a href="#7-启动服务">7、启动服务</a></li>
<li><a href="#8-副本模式初始化集群">8、副本模式初始化集群</a></li>
<li><a href="#9-查看集群状态">9、查看集群状态</a></li>
<li><a href="#10-创建用户">10、创建用户</a></li>
<li><a href="#11-用户权限说明">11、用户权限说明</a></li>
<li><a href="#12-创建业务库-graylog-ff-与独立账户graylog">12、创建业务库(graylog_ff)与独立账户graylog</a></li>
</ul></li>
<li><a href="#二-备份与恢复">二、备份与恢复</a></li>
<li><a href="#三-常用命令">三、常用命令</a></li>
</ul></li>
</ul></li>
</ul>
</nav>
                
                

<h2 id="mongodb副本集群部署-备份-恢复与常用命令">mongodb副本集群部署，备份，恢复与常用命令</h2>

<h3 id="一-部署">一、部署</h3>

<h4 id="1-实验环境">1、实验环境</h4>

<pre><code>副本集模式，一主两副本，集群是自动分配主副的。客户端这三个ip都要配置上。
192.168.177.140
192.168.177.138
192.168.177.139
</code></pre>

<h4 id="2-下载">2、下载</h4>

<pre><code>https://www.mongodb.com/try/download/community
以上链接选择对应版本的mongodb软件包

本次试验的版本与类型选择如下：
version：3.6.19
platform：CentOS 7.0
Package：tgz

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.6.19.tgz
</code></pre>

<h4 id="3-解压安装包">3、解压安装包</h4>

<pre><code>1、三个节点都下载tgz包到/data/packages/目录下，并创建必要目录
ansible -i mongo.hosts all -m shell -a &quot;mkdir -p /data/mongodb/graylog/{data,logs,key}&quot; -b
2、解压
ansible -i mongo.hosts all -m shell -a &quot;tar xzf /data/packages/mongodb-linux-x86_64-rhel70-3.6.19.tgz -C /data/mongodb/&quot; -b
3、重命名
ansible -i mongo.hosts all -m shell -a &quot;mv /data/mongodb/mongodb-linux-x86_64-rhel70-3.6.19 /data/mongodb/mongodb&quot; -b
</code></pre>

<h4 id="4-修改配置文件">4、修改配置文件</h4>

<p>mongod.conf</p>

<pre><code>port            =   44477
pidfilepath     =   /data/mongodb/graylog/data/mongod1.pid
fork            =   true
dbpath          =   /data/mongodb/graylog/data
logpath         =   /data/mongodb/graylog/logs/mongod1.log
logappend       =   true
logRotate       =   rename
journal         =   true
directoryperdb  =   true
quiet           =   true
auth           =   true
keyFile        =   /data/mongodb/graylog/key/mongodb-keyfile
profile         =   1
slowms          =   2000
bind_ip         =   0.0.0.0

storageEngine   =   wiredTiger
wiredTigerDirectoryForIndexes = true
wiredTigerCollectionBlockCompressor = snappy
wiredTigerJournalCompressor = snappy
wiredTigerCacheSizeGB = 10

replSet       =   graylog_repl
oplogSize     =    50000

#推送配置文件
ansible -i mongo.hosts all -m copy -a &quot;src=mongod.conf dest=/data/mongodb/mongodb/&quot; -b
</code></pre>

<h4 id="5-集群认证keyfile">5、集群认证keyFile</h4>

<p>增加集群之间的复制keyFile认证，将该key放到集群中机器的每一台上，记住必须保持一致，权限设置成600</p>

<pre><code>#生成key
openssl rand -base64 745 &gt; /data/mongodb/graylog/key/mongodb-keyfile
chmod 600 /data/mongodb/graylog/key/mongodb-keyfile
# 该key的权限必须是600
</code></pre>

<h4 id="6-配置systemd启动">6、配置systemd启动</h4>

<pre><code>[paas@paas-ops playbook]$ cat mongodb.service
[Unit]

Description=mongodb
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/data/mongodb/mongodb/bin/mongod -f /data/mongodb/mongodb/mongod.conf
ExecStop=/data/mongodb/mongodb/bin/mongod --shutdown -f /data/mongodb/graylog/data/
PrivateTmp=true

[Install]
WantedBy=multi-user.target

下发文件：
ansible -i mongo.hosts all -m copy -a &quot;src=mongodb.service dest=/usr/lib/systemd/system/&quot; -b
</code></pre>

<h4 id="7-启动服务">7、启动服务</h4>

<pre><code>ansible -i mongo.hosts all -m shell -a &quot;systemctl start mongodb&quot; -b
</code></pre>

<h4 id="8-副本模式初始化集群">8、副本模式初始化集群</h4>

<p>连接到任意一台mongodb上，添加集群的配置</p>

<pre><code>[root@phweb-new01 ~]# /data/mongodb/mongodb/bin/mongo  127.0.0.1:44477
&gt; config = {
    &quot;_id&quot; : &quot;graylog_repl&quot;,
    &quot;members&quot; : [
        {
            &quot;_id&quot; : 0,
            &quot;host&quot; : &quot;192.168.177.138:44477&quot;
        },
        {
            &quot;_id&quot; : 1,
            &quot;host&quot; : &quot;192.168.177.139:44477&quot;
        },
        {
            &quot;_id&quot; : 2,
            &quot;host&quot; : &quot;192.168.177.140:44477&quot;
        }
    ]
}
&gt; rs.initiate(config)
{ &quot;ok&quot; : 1 }
</code></pre>

<h4 id="9-查看集群状态">9、查看集群状态</h4>

<p>其中&rdquo;stateStr&rdquo; : &ldquo;PRIMARY&rdquo;,为主节点。另外两个&rdquo;stateStr&rdquo; : &ldquo;SECONDARY&rdquo;,是副本节点。</p>

<pre><code>graylog_repl:PRIMARY&gt; rs.status()
</code></pre>

<h4 id="10-创建用户">10、创建用户</h4>

<pre><code>1、连接主节点
/data/mongodb/mongodb/bin/mongo  127.0.0.1:44477
添加用户
use admin #切换到admin库，默认连接的是test数据库
db.createUser({user:&quot;admin&quot;,pwd:&quot;123456&quot;,roles:[{role:&quot;userAdminAnyDatabase&quot;,db:&quot;admin&quot;}]})

2、重启集群
ansible -i mongo.hosts all -m shell -a &quot;systemctl stop mongodb&quot; -b
ansible -i mongo.hosts all -m shell -a &quot;systemctl start mongodb&quot; -b

3、从新登录主节点（此时主节点可能换成别的服务器上了）
/data/mongodb/mongodb/bin/mongo  127.0.0.1:44477 --authenticationDatabase admin -uadmin

4、修改admin用户权限为超级管理员
graylog_repl:PRIMARY&gt; use admin
switched to db admin
graylog_repl:PRIMARY&gt; db.grantRolesToUser(
... ... &quot;admin&quot;,
... ... [{role:&quot;root&quot;, db:&quot;admin&quot;}]
... ... )
graylog_repl:PRIMARY&gt; show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
</code></pre>

<h4 id="11-用户权限说明">11、用户权限说明</h4>

<pre><code>1.数据库用户角色：read、readWrite;
2.数据库管理角色：dbAdmin、dbOwner、userAdmin；
3.集群管理角色：clusterAdmin、clusterManager、clusterMonitor、hostManager；
4.备份恢复角色：backup、restore
5.所有数据库角色：readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase
6.超级用户角色：root
</code></pre>

<h4 id="12-创建业务库-graylog-ff-与独立账户graylog">12、创建业务库(graylog_ff)与独立账户graylog</h4>

<p>mongodb默认三个库，admin库用于配置信息，例如添加账户需要use admin。config和local库用于本地与集群配置使用。不能用于业务使用<br />
因此需要独立建立业务库并创建业务库的用户,(注意：一定要在graylog_ff这个库下执行db.createUser)</p>

<pre><code>登录主库
/data/mongodb/mongodb/bin/mongo  127.0.0.1:44477 --authenticationDatabase admin -uadmin -p123456
创建新数据库
use graylog_ff
赋权
db.createUser(
... {
...   user: &quot;graylog&quot;,
...   pwd: &quot;Vht1xc59&quot;,
...   roles: [ { role: &quot;readWrite&quot;, db: &quot;graylog_ff&quot;} ]
... }
... )

</code></pre>

<h3 id="二-备份与恢复">二、备份与恢复</h3>

<p>此方式只适用不需要增量数据的。例如本例的graylog，只存储配置信息，即使数据库挂了，也不影响graylog收集日志，但是graylog重启连不上mongodb就起不来了，不重启没事。
- 备份</p>

<pre><code>mongodump -u admin -p asdfsadfsda --port 44477 --authenticationDatabase admin -d graylog_ff -o /data/backup/20200901/
</code></pre>

<ul>
<li>恢复
<code>
/data/mongodb/mongodb/bin/mongorestore -h 127.0.0.1:44477 -u graylog -p Vht1xc59  -d graylog_ff graylog_ff --drop --authenticationDatabase admin
</code></li>
</ul>

<h3 id="三-常用命令">三、常用命令</h3>

<pre><code>1、查看当前所在库（默认登录test库）
db

2、查看有哪些库
show dbs

3、进入数据库（如果数据库不存在则创建，并且新创建的数据库通过show dbs是看不到的，只有写入了数据能看到）
use graylog_ff

4、查看当前库有哪些用户(mongodb是用id来区分用户的而不是名称，例如admin库可以创建graylog_ff用户，graylog库也可以创建graylog_ff用户，如果权限是dbAdmin，那就只能负责自己的库)
必须进入到相应的库来执行。每个库的用户不一样。
数据库角色参考：https://www.cnblogs.com/ljhdo/archive/2016/10/28/4863318.html
show users

5、创建用户并赋权
db.createUser(
... {
...   user: &quot;graylog&quot;,
...   pwd: &quot;abcacb&quot;,
...   roles: [ { role: &quot;readWrite&quot;, db: &quot;graylog_ff&quot;} ]
... }
... )

6、添加用户权限（一个用户可以有多个权限）
db.grantRolesToUser( &quot;graylog&quot; , [ { role: &quot;dbAdmin&quot;, db: &quot;graylog_ff&quot; } ])

7、查看库里的表
show tables

8、查看副本集群状态
rs.status()

9、查看数据库版本
db.version()

10、查看数据库中有哪些合集
show collections

11、查看abc合集中的数据（查）
db.abc.find()
db.abc.find({a:2}) #过滤包含a=2的数据

12、插入当前库abc合集中的一条数据（增）
db.abc.insertOne({&quot;123&quot; : &quot;123-val&quot;, &quot;a&quot; : 34, &quot;b&quot; : 36})

13、修改abc合集中的一个字段（改）
db.abc.update({'title':'MongoDB 教程'},{$set:{'title':'MongoDB'}})

14、删除合集中匹配到a=34的数据（删）
db.abc.deleteMany({a:34})

15、删除合集
db.abc.drop()
</code></pre>


                
                
<div class="entry-shang text-center">
    
	    <p>「真诚赞赏，手留余香」</p>
	
	<button class="zs show-zs btn btn-bred">赞赏支持</button>
</div>
<div class="zs-modal-bg"></div>
<div class="zs-modal-box">
	<div class="zs-modal-head">
		<button type="button" class="close">×</button>
		<span class="author"><a href="https://masxhub.gitee.io/blog"><img src="/blog/img/favicon.png" />Mashaoxun Blog</a></span>
        
	        <p class="tip"><i></i><span>真诚赞赏，手留余香</span></p>
		
 
	</div>
	<div class="zs-modal-body">
		<div class="zs-modal-btns">
			<button class="btn btn-blink" data-num="2">2元</button>
			<button class="btn btn-blink" data-num="5">5元</button>
			<button class="btn btn-blink" data-num="10">10元</button>
			<button class="btn btn-blink" data-num="20">20元</button>
			<button class="btn btn-blink" data-num="50">50元</button>
			<button class="btn btn-blink" data-num="100">100元</button>
		</div>
		<div class="zs-modal-pay">
			<button class="btn btn-bred" id="pay-text">2元</button>
			<p>使用<span id="pay-type">微信</span>扫描二维码完成支付</p>
			<img src="/blog/img/reward/zanshang.jpg"  id="pay-image"/>
		</div>
	</div>
	<div class="zs-modal-footer">
		<label><input type="radio" name="zs-type" value="wechat" class="zs-type" checked="checked"><span ><span class="zs-wechat"><img src="/blog/img/reward/wechat-btn.png"/></span></label>
		<label><input type="radio" name="zs-type" value="alipay" class="zs-type" class="zs-alipay"><img src="/blog/img/reward/alipay-btn.png"/></span></label>
	</div>
</div>
<script type="text/javascript" src="/blog/js/reward.js"></script>

                

                <hr>
                <ul class="pager">
                    
                    <li class="previous">
                        <a href="2020/08/14/ports-state/" data-toggle="tooltip" data-placement="top" title="批量检测端口连通性">&larr;
                            Previous Post</a>
                    </li>
                    
                    
                </ul>

                
<div id="disqus-comment"></div>



            </div>
            
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                sidebar-container">

                
                
                <section>
                    <hr class="hidden-sm hidden-xs">
                    <h5><a href="/tags/">FEATURED TAGS</a></h5>
                    <div class="tags">
                        
                        
                        
                        <a href="/blog/tags/ceph" title="ceph">
                            ceph
                        </a>
                        
                        
                        
                        
                        
                        <a href="/blog/tags/docker" title="docker">
                            docker
                        </a>
                        
                        
                        
                        <a href="/blog/tags/k8s" title="k8s">
                            k8s
                        </a>
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        <a href="/blog/tags/%E5%AD%98%E5%82%A8" title="存储">
                            存储
                        </a>
                        
                        
                        
                        <a href="/blog/tags/%E7%9B%91%E6%8E%A7" title="监控">
                            监控
                        </a>
                        
                        
                        
                        
                    </div>
                </section>
                

                
                
                <section>
                    <hr>
                    <h5>FRIENDS</h5>
                    <ul class="list-inline">
                        
                        <li><a target="_blank" href="http://www.zrq.org.cn">瑞卿博客</a></li>
                        
                    </ul>
                </section>
                
            </div>
        </div>
    </div>
</article>




<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                   
                    
                    <li>
                        <a href="mailto:youremail@gmail.com">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-envelope fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
		    
                    
                    
                    
                    

                    

		    
                    
                    <li>
                        <a target="_blank" href="/blog/img/404.jpeg">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-wechat fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
		    
                    
                    <li>
                        <a target="_blank" href="https://github.com/yourgithub">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
		    
                    
                    
                </ul>
		<p class="copyright text-muted">
                    Copyright &copy; Mashaoxun Blog , 2020
                    <br>
                    <a href="https://themes.gohugo.io/hugo-theme-cleanwhite">CleanWhite Hugo Theme</a> by <a href="https://zhaohuabing.com">Huabing</a> |
                    <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="100px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user=zhaohuabing&repo=hugo-theme-cleanwhite&type=star&count=true" >
                    </iframe>
                </p>
            </div>
        </div>
    </div>
</footer>




<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>






<script>
    
    if($('#tag_cloud').length !== 0){
        async("/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>


<script>
    async("https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<script>
    (function(){
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https'){
       bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
      }
      else{
      bp.src = 'http://push.zhanzhang.baidu.com/push.js';
      }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>







</body>
</html>
